package com.pr.makfilm.domain;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * Created with IntelliJ IDEA.
 * User: Pawel
 * Date: 17.09.13
 * Time: 22:57
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "room_place")
public class RoomPlace extends IdentifiableEntity
{
   public static final String FIELD_ROOM = "room";

   public static final String FIELD_ROW = "row";

   public static final String FIELD_COLUMN = "column";

   public static final String FIELD_TYPE = "type";

   public static final int MAX_LENGTH_LABEL = 12;

   @Id
   @GeneratedValue
   @Column
   private Long id;

   @OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, fetch = FetchType.LAZY)
   @JoinColumn(nullable = false)
   @NotNull
   private Room room;

   @Column(name = "row_number", nullable = false)
   @NotNull
   private Integer row;

   @Column(name = "column_number", nullable = false)
   @NotNull
   private Integer column;

   @Column(nullable = false)
   @Enumerated(value = EnumType.STRING)
   @NotNull
   private RoomPlaceTypeEnum type;

   @Column(length = MAX_LENGTH_LABEL)
   private String label;

   public Long getId()
   {
      return id;
   }

   public Room getRoom()
   {
      return room;
   }

   public void setRoom(Room room)
   {
      this.room = room;
   }

   public void setId(Long id)
   {
      this.id = id;
   }

   public Integer getRow()
   {
      return row;
   }

   public void setRow(Integer row)
   {
      this.row = row;
   }

   public Integer getColumn()
   {
      return column;
   }

   public void setColumn(Integer column)
   {
      this.column = column;
   }

   public RoomPlaceTypeEnum getType()
   {
      return type;
   }

   public void setType(RoomPlaceTypeEnum type)
   {
      this.type = type;
   }

   public String getLabel()
   {
      return label;
   }

   public void setLabel(String label)
   {
      this.label = label;
   }
}
